package com.fengmoxi.ctv.activity.config.lamp.other;

import android.os.Bundle;
import android.util.DisplayMetrics;

import androidx.fragment.app.FragmentActivity;
import androidx.leanback.app.BackgroundManager;

import com.fengmoxi.ctv.R;
import com.fengmoxi.ctv.activity.config.lamp.ConfigLampActivity;
import com.fengmoxi.ctv.manage.HomeButtonReceiver;

public class ConfigLampInitParamActivity extends FragmentActivity {
    private static final String TAG = ConfigLampInitParamActivity.class.getSimpleName();
    private HomeButtonReceiver mHomeButtonReceiver;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_config_lamp_init_param);

        BackgroundManager mBackgroundManager = BackgroundManager.getInstance(this);
        mBackgroundManager.attach(getWindow());
        DisplayMetrics mMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

        mHomeButtonReceiver = new HomeButtonReceiver(this, new HomeButtonReceiver.OnHomeBtnPressListener() {
            @Override
            public void onHomeBtnPress() {
                if (ConfigLampActivity.configLampActivity != null) {
                    ConfigLampActivity.configLampActivity.finish();
                }
                finish();
            }

            @Override
            public void onHomeBtnLongPress() {

            }
        });
        mHomeButtonReceiver.start();
    }

    @Override
    protected void onDestroy() {
        mHomeButtonReceiver.stop();
        super.onDestroy();
    }
}